class ImageEntry
{
  public int id;
  public String fileName;
  public Time uploadTime;
  public int rateAudio;
  public int rateVideo;
  public int rateTotal;
  public int viewCount;
   
  public void setId(String value)
  {
    id = Integer.parseInt(value);
  }

  public void setFileName(String value)
  {
    fileName = value;
  }

  public void setUploadTime(String value)
  {
    uploadTime = new Time(value);
  }

  public void setRateAudio(String value)
  {
     rateAudio = Integer.parseInt(value);
  }

  public void setRateVideo(String value)
  {
    rateVideo = Integer.parseInt(value);
  }

  public void setRateTotal(String value)
  {
     rateTotal = Integer.parseInt(value);
  }

  public void setViewCount(String value)
  {
    viewCount = Integer.parseInt(value);
  }
  
  public boolean isDownloaded()
  {
    File file = new File(props.getProperty("absoluteDataPath") + fileName);
    return file.exists();
  }
  
  public String toString()
  {
    return "ID: " + id + "\n" + 
           "Filename: " + fileName + "\n" +            
           uploadTime + "\n" + 
           "Rate: Audio " + rateAudio + " Video " + rateVideo + " Total " + rateTotal + "\n" + 
           "View Count: " + viewCount + "\n" +    
           "Downloaded: " + isDownloaded();   
  }
  
  
}

class ImageEntryComparator implements Comparator
{
  public int compare(Object img1, Object img2)
  {
    int img1Rating = ((ImageEntry)img1).viewCount;
    int img2Rating = ((ImageEntry)img2).viewCount;
    
    if(img1Rating > img2Rating)
      return 1;
    else if(img1Rating < img2Rating)
      return -1;
    else
       return 0;    
  } 
}
